home *** CD-ROM | disk | FTP | other *** search
/ Aminet 8 / Aminet 8 (1995)(GTI - Schatztruhe)[!][Oct 1995].iso / Aminet / dev / gcc / gcc270_src.lha / gcc-2.7.0-amiga / config / clipper / clix.h < prev    next >
C/C++ Source or Header  |  1995-06-15  |  5KB  |  165 lines

  1. /* Definitions of target machine for GNU compiler.  Clipper/Clix version.
  2.    Copyright (C) 1988, 1993 Free Software Foundation, Inc.
  3.  
  4. This file is part of GNU CC.
  5.  
  6. GNU CC is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2, or (at your option)
  9. any later version.
  10.  
  11. GNU CC is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with GNU CC; see the file COPYING.  If not, write to
  18. the Free Software Foundation, 59 Temple Place - Suite 330,
  19. Boston, MA 02111-1307, USA.  */
  20.  
  21. #include "clipper/clipper.h"
  22.  
  23. #include "svr3.h"
  24.  
  25. /* Names to predefine in the preprocessor for this target machine.  */
  26.  
  27. #define CPP_PREDEFINES "-Dclipper -Dunix -Asystem(unix) -Asystem(svr3) -Acpu(clipper) -Amachine(clipper)"
  28.  
  29. #undef STARTFILE_SPEC
  30. #define STARTFILE_SPEC  \
  31.   "%{pg:gcrt1.o%s}%{!pg:%{p:mcrt1.o%s}%{!p:crt1.o%s}} crtbegin.o%s"
  32.  
  33. #undef ENDFILE_SPEC
  34. #define ENDFILE_SPEC "crtend.o%s crtn.o%s"
  35.  
  36. #undef LIB_SPEC
  37.  
  38. #undef HAVE_ATEXIT
  39. #define HAVE_ATEXIT
  40.  
  41. #define ASM_OUTPUT_ASCII(FILE,PTR,LEN)            \
  42. do {                            \
  43.   unsigned char *s;                    \
  44.   int i;                        \
  45.   for (i = 0, s = (unsigned char *)(PTR); i < (LEN); s++, i++)    \
  46.     {                            \
  47.       if ((i % 8) == 0)                    \
  48.     fputs ("\n\t.byte\t", (FILE));            \
  49.       fprintf ((FILE), "%s0x%x", (i%8?",":""), (unsigned)*s); \
  50.     }                            \
  51.   fputs ("\n", (FILE));                    \
  52. } while (0)
  53.  
  54. #undef ASM_OUTPUT_DOUBLE
  55. #define ASM_OUTPUT_DOUBLE(FILE,VALUE)    \
  56. {                    \
  57.   union { int i[2]; double d; } _d_;    \
  58.   _d_.d = VALUE;                \
  59.   fprintf (FILE, "\t.long 0x%08x,0x%08x\n", _d_.i[0],_d_.i[1]); \
  60. }
  61.  
  62. #undef ASM_OUTPUT_FLOAT
  63. #define ASM_OUTPUT_FLOAT(FILE,VALUE)    \
  64. {                    \
  65.   union { int i; float f; } _f_;    \
  66.   _f_.f = VALUE;                \
  67.   fprintf (FILE, "\t.long 0x%08x\n", _f_.i); \
  68. }
  69.  
  70. /* This is how to output an assembler line
  71.    that says to advance the location counter
  72.    to a multiple of 2**LOG bytes.  */
  73.  
  74. #define ASM_OUTPUT_ALIGN(FILE,LOG) \
  75.   fprintf(FILE, "\t.align %d\n", 1 << (LOG))
  76.  
  77.  
  78. #define ASM_LONG ".long"
  79. #define BSS_SECTION_ASM_OP  ".bss"
  80. #undef INIT_SECTION_ASM_OP
  81. #define INIT_SECTION_ASM_OP ".section .init,\"x\""
  82.  
  83.  
  84. /* Define a few machine-specific details of the implementation of
  85.    constructors.
  86.  
  87.    The __CTORS_LIST__ goes in the .init section.  Define CTOR_LIST_BEGIN
  88.    and CTOR_LIST_END to contribute to the .init section an instruction to
  89.    push a word containing 0 (or some equivalent of that).
  90.  
  91.    ASM_OUTPUT_CONSTRUCTOR should be defined to push the address of the
  92.    constructor.  */
  93.  
  94. #define CTOR_LIST_BEGIN                \
  95.   asm (INIT_SECTION_ASM_OP);            \
  96.   asm ("subq   $8,sp");                \
  97.   asm ("loadq  $0,r0");                \
  98.   asm ("storw  r0,(sp)")
  99.  
  100. /* don't need end marker */
  101.  
  102. #undef CTOR_LIST_END
  103.  
  104. #define ASM_OUTPUT_CONSTRUCTOR(FILE,NAME)    \
  105.   do {                        \
  106.     init_section ();                \
  107.     fputs ("\tloada  ", FILE);            \
  108.     assemble_name (FILE, NAME);            \
  109.     fputs (",r0\n\tsubq   $8,sp\n\tstorw   r0,(sp)\n", FILE);    \
  110.   } while (0)
  111.  
  112.  
  113. /* fini psect is 8 aligned */
  114.  
  115. #define DTOR_LIST_BEGIN    \
  116.   asm (DTORS_SECTION_ASM_OP);                \
  117.   func_ptr __DTOR_LIST__[2] = { (func_ptr) (-1), 0 };
  118.  
  119. /* A C statement (sans semicolon) to output an element in the table of
  120.    global destructors.  */
  121.  
  122. #undef ASM_OUTPUT_DESTRUCTOR
  123. #define ASM_OUTPUT_DESTRUCTOR(FILE,NAME)                       \
  124.   do {                                    \
  125.     fini_section ();                                       \
  126.     fprintf (FILE, "%s\t ", ASM_LONG);                    \
  127.     assemble_name (FILE, NAME);                              \
  128.     fprintf (FILE, ",0\n");                        \
  129.   } while (0)
  130.  
  131.  
  132. /* On clix crt1.o first calls init code and then sets environ and a valid
  133.    chrclass. Unfortunately stdio routines bomb with unset chrclass.
  134.    Therefore we set chrclass prior to calling global constructors. */
  135.  
  136. #undef DO_GLOBAL_CTORS_BODY
  137. #define DO_GLOBAL_CTORS_BODY                    \
  138. do {                                \
  139.   func_ptr *p, *beg = alloca (0);                \
  140.   _setchrclass (0);                        \
  141.   for (p = beg; *p; p+=2)                    \
  142.     ;                                \
  143.   while (p != beg)                        \
  144.     { p-= 2; (*p) (); }                        \
  145. } while (0)
  146.  
  147.  
  148. #undef DO_GLOBAL_DTORS_BODY
  149. #define DO_GLOBAL_DTORS_BODY    \
  150.   func_ptr *f = &__DTOR_LIST__[2];    /* 0,1 contains -1,0 */    \
  151.   int n = 0;                            \
  152.   while (*f)                            \
  153.     {                                \
  154.      f+= 2;                /* skip over alignment 0 */    \
  155.      n++;                            \
  156.     }                                \
  157.   f -= 2;                            \
  158.   while (--n >= 0)                        \
  159.     {                                \
  160.      (*f) ();                            \
  161.      f-= 2;                /* skip over alignment 0 */    \
  162.     }
  163.  
  164.  
  165.